﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Xna.Framework;
using LastStand.gameContent.Friendlies;
using Microsoft.Xna.Framework.Graphics;

namespace LastStand.gameContent
{
	public class Shot : Sprite
	{
		//where is this shot coming from?
		private Vector2 origin;

        //where is this shot going to?
        private Vector2 dest;

		public Vector2 GetOrigin
		{
			get { return origin; }
		}

		private float angle;

		public float GetAngle
		{
			get { return this.angle; }
		}

		//how much damage will this shot have on its target?
		private float damage;

		public float Damage
		{
			get { return damage; }
		}

		public Shot(Vector2 orig, float ang, Vector2 vel, Vector2 dest, Texture2D text)
		{
			//the origin of the shot.
			this.origin = orig;

			//sets the angle of the shot
			this.angle = ang;

			//velocity of the shot
			this.Velocity = vel;

            this.Position = orig;

            //shots destination
            this.dest = dest;

            this.Texture = text;

			this.VelocityY = this.GetVelocity.Y * angle;

            /*//move using angle of fire, velocity, and position
            float rise = (dest.Y - origin.Y)/30;
            float run = (dest.X - origin.X)/30;

            velocity = new Vector2(20, (dest.Y - GetOrigin.Y)/
									((dest.X - GetOrigin.X)/20));
			 */
		}

		public override void Update(GameTimerEventArgs elapsedTime)
		{
            this.Position = this.velocity + this.GetPosition;
            base.Update(elapsedTime);
		}

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            sb.Draw(this.Texture,
                this.GetPosition,
                null,
                Microsoft.Xna.Framework.Color.White,
                0.0f,
                Vector2.Zero,
                1.0f,
                SpriteEffects.None,
                0);
            base.Draw(sb);
        }
	}
}
